<script setup>

const {proxy} = getCurrentInstance();
const {ky_yw, ky_jcjb, ky_hrjgl, ky_sf, ky_yjqk, ky_yyxjg, ky_xys, ky_jcjg, sys_user_sex} =
    proxy.useDict("ky_yw", "ky_jcjb", "ky_hrjgl", "ky_sf", "ky_yjqk", "ky_yyxjg", "ky_xys", "ky_jcjg", "sys_user_sex");
const form = ref({});
const isBeginEdit = ref(false);
const emit = defineEmits(['saveEditZlbzw'])
const props = defineProps({
  showInfo: {
    type: Boolean,
    default: false,
  },
  patientObject: {
    type: Object,
    default: () => {
    },
  }
});

function beginEdit() {
  isBeginEdit.value = true;
}

function cancelEdit() {
  isBeginEdit.value = false;
  form.value = props.patientObject;
}

function saveEdit() {
  isBeginEdit.value = false;
  // console.log("保存的信息", form.value);
  emit("saveEditZlbzw", form.value);
}

onMounted(() => {
  // console.log("传入的参数对象在", props.patientObject);
  form.value = props.patientObject;
});

watch(props, (newProps) => {
  form.value = newProps.patientObject;
});


</script>
<template>
  <div style="background: #fff">
    <div style="margin-bottom: 20px; padding: 20px; border-radius: 5px">
      <el-row justify="end">
        <el-col :lg="8" :md="12" :sm="24" style="display: flex;justify-content: end;">
          <el-button v-show="!isBeginEdit" @click="beginEdit" icon="editPen">编辑信息</el-button>
          <el-button v-show="isBeginEdit" @click="cancelEdit" icon="close">取消编辑</el-button>
          <el-button v-show="isBeginEdit" type="primary" @click="saveEdit" icon="select">保存信息</el-button>
        </el-col>
      </el-row>

      <div style="text-align: center; border-bottom: none">
        <el-form
          :model="form"
          label-position="right"
          label-width="140"
          :disabled="!isBeginEdit"
          style="width: 100%; margin: 0 auto"
        >
          <el-row>
            <el-col :span="6">
              <el-form-item label="Septin9检查结果">
                <el-select
                    v-model="form.s9"
                    placeholder="请选择"
                    clearable
                    style="width: 190px"
                >
                  <el-option
                      v-for="dict in ky_yyxjg"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                  ></el-option>
                </el-select>
              </el-form-item
              >
            </el-col>

            <el-col :span="6">
              <el-form-item label="FIT-DNA结果">
                <el-select
                    v-model="form.fitDna"
                    placeholder="FIT-DNA结果"
                    clearable
                    style="width: 190px"
                >
                  <el-option
                      v-for="dict in ky_yyxjg"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="6">
              <el-form-item label="C19-9检查结果">
                <el-select
                    v-model="form.ca199"
                    placeholder="CA19-9检查结果"
                    clearable
                    style="width: 190px"
                >
                  <el-option
                      v-for="dict in ky_jcjg"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="C19-9检查异常结果">
                <el-input
                    v-model="form.ca199Jg"
                    placeholder="C19-9检查异常结果"
                    clearable
                />

              </el-form-item>
            </el-col>
          </el-row>

          <el-row>

            <el-col :span="6">
              <el-form-item label="CEA检查结果">
                <el-select
                    v-model="form.cea"
                    placeholder="CEA检查结果"
                    clearable
                    style="width: 190px"
                >
                  <el-option
                      v-for="dict in ky_jcjg"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                  />
                </el-select>

              </el-form-item>
            </el-col>

            <el-col :span="6">
              <el-form-item label="CEA检查异常结果">
                <el-input
                    v-model="form.ceaJg"
                    placeholder="CEA检查异常结果"
                    clearable
                />
              </el-form-item>
            </el-col>
          </el-row>

          <!--          <el-row>-->
          <!--            <el-col :span="6">-->
          <!--              <el-form-item label="肠镜">-->


          <!--                <el-select-->
          <!--                    v-model="form.cj"-->
          <!--                    placeholder="肠镜结果"-->
          <!--                    clearable-->
          <!--                    style="width: 190px"-->
          <!--                >-->
          <!--                  <el-option-->
          <!--                      v-for="dict in ky_jcjg"-->
          <!--                      :key="dict.value"-->
          <!--                      :label="dict.label"-->
          <!--                      :value="dict.value"-->
          <!--                  />-->
          <!--                </el-select>-->

          <!--              </el-form-item>-->
          <!--            </el-col>-->

          <!--            <el-col :span="6">-->
          <!--              <el-form-item label="肠镜异常结果">-->
          <!--                <el-input-->
          <!--                    v-model="form.cjJg"-->
          <!--                    placeholder="肠镜异常结果"-->
          <!--                    clearable-->
          <!--                />-->

          <!--              </el-form-item>-->
          <!--            </el-col>-->

          <!--          </el-row>-->

          <el-row>
            <el-col :span="12">
              <el-form-item label="其它肿瘤标志物检查结果">
                <el-input
                    v-model="form.qtzlbzw"
                    style="width: 500px"
                    :rows="2"
                    type="textarea"
                    placeholder="其它肿瘤标志物检查结果"
                />
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped></style>
